<%@codepage="65001"%>
<%session.codepage="65001"%>
<!-- #include virtual=/inc/dbConn.asp -->
<!-- #include virtual=/inc/function.asp -->
<!-- #include virtual=/inc/action.header.inc.asp -->

<%
	'## 파라미터 변수 선언부
	titles			= Request("findTitles")
	contents		= Request("findContents")

	
	SQLTitle = "-- ■■■■ 게시판 그리드 List up ■■■■"
	
	'## 검색조건에 따른 조건절 만들기 
	If titles <> "" Then 
		addSql = " A.titles LIKE '%" & titles & "%' "
	End If 
	If contents <> "" Then 
		If addSql <> "" Then addSql = addSql & " AND "
		addSql = addSql & " A.contents LIKE '%" & contents & "%' "
	End If 
	If addSql <> "" Then 
		addSql = " WHERE " & addSql 
	End If 

	SQL = "SELECT A.seq, A.titles, B.userNm, A.noticeFlag, A.hit, A.startDt, A.endDt, CONVERT(varchar(10), A.issueDt, 121) wdate, A.flag FROM tblBoard A LEFT JOIN tblUser B ON A.userId=B.userId " & addSql & " ORDER BY A.issueDt DESC" 

	If xMode="debug" Then 
		Call showDebug(SQLTitle,SQL) 
	End If 

	Set Rs=Server.CreateObject("ADODB.RecordSet")
	Rs.open SQL, DbCon, 1
	
	Response.write "<Board>" & vbcrlf

	If Rs.eof Or Rs.bof Then 
	Else 
		Do Until Rs.eof Or Rs.bof
			
			terms = ""
			If rs("startDt") <> "" Then 
				terms = rs("startDt")
			End If 
			
			If rs("endDt") <> "" Then 
				If terms <> "" Then 
					terms = terms & "<br>~" & Right(rs("endDt"),5)
				Else
					terms = terms & "~" & rs("endDt")
				End If 
			End If 
			
			If terms = "" Then terms = "&nbsp;" End If 
			titles = rs("titles")
			If Len(titles) > 18 Then
				titles = Left(titles,18) & "..."
			End If 
		
			Response.write "	<BbsList>" & vbcrlf
				Call mkXMLNode("seq", rs("seq"), 2)
				Call mkXMLNode("titles", titles, 2)
				Call mkXMLNode("userNm", rs("userNm"), 2)
				Call mkXMLNode("noticeFlag", rs("noticeFlag"), 2)
				Call mkXMLNode("hit", rs("hit"), 2)
				Call mkXMLNode("terms", terms, 2)
				Call mkXMLNode("wdate", rs("wdate"), 2)
				Call mkXMLNode("flag", Rs("flag"), 2)
			Response.write "	</BbsList>" & vbcrlf

		Rs.movenext
		Loop 
	End If
	Response.write "</Board>" & vbcrlf
'	Call rsWithXML("Save OK!")
%>